package com.block.datapush.common.filter.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.block.common.service.LogFactory;
import com.block.datapush.common.enums.FilterErrorEnum;
import com.block.datapush.common.filter.IFilterHandlerService;
import com.block.datapush.common.model.param.FilterHandlerParam;
import com.block.datapush.common.model.result.FilterHandlerResult;
import com.block.db.entity.MemberExtInfo;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FilterStatusHandlerService implements IFilterHandlerService {

    private static Logger log = LogFactory.getPushLog();

    @Override
    public FilterHandlerResult handlerFilterLogic(FilterHandlerParam handlerParam, MemberExtInfo memberExtInfo) {

        if (ObjectUtil.equal(handlerParam.getStatus(), Integer.valueOf(1))){
            return FilterHandlerResult.success();
        }

        String message = StrUtil.format("【itemId】{}【status】{}", handlerParam.getItemId(), handlerParam.getStatus());
        log.info("【机构条件判断】false【状态 】{}", message);
        return FilterHandlerResult.error(FilterErrorEnum.STATUS_ERROR, message);
    }
}
